package com.gitee.mars.marsquickframe.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gitee.mars.marsquickframe.entity.SysRole;
import com.gitee.mars.marsquickframe.response.base.BasePageRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 持久层
 *
 * @Author wq
 * @Date 2020-12-15
 **/
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {

    IPage<SysRole> findByQuery(IPage<SysRole> page, @Param("query") BasePageRequest query);

    /**
     * 查询该角色下面有没有用户
     *
     * @param roleId 角色ID
     * @return int
     */
    Integer selectSysUser(@Param("roleId") Integer roleId);

    /**
     * 根据角色ID查询角色名称
     *
     * @param roleId 角色ID
     * @return string
     */
    String selectRoleTitle(@Param("roleId") Integer roleId);
}
